/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.fyx.core;

import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import org.fyx.core.controll.FyxAtributeFacadeLocal;
import org.fyx.core.entity.FyxAtribute;

/**
 *
 * @author xljan
 */
@Stateless
public class FyxCoreBean implements FyxCoreLocal {
    @EJB
    private FyxAtributeFacadeLocal fyxAtributeFacade;

    @Override
    public void setAtribute(FyxAtribute atribute) {
        FyxAtribute fAtribute = fyxAtributeFacade.find(atribute.getKey());
        if(fAtribute != null){
            fyxAtributeFacade.edit(atribute);
            return;
        }
        fyxAtributeFacade.create(atribute);
    }

    @Override
    public FyxAtribute getAtribute(String key) {
        return fyxAtributeFacade.find(key);
    }

    @Override
    public List<FyxAtribute> getAtributes() {
        return fyxAtributeFacade.findAll();
    }
}
